home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1997 #1 / Amiga Plus CD - 1997 - No. 01.iso / pd / sonstiges / amiwin / x11 / man / xcalc.man < prev    next >
Text File  |  1985-03-23  |  18KB  |  530 lines

  1.  
  2.  
  3.  
  4. XCALC(1)                 USER COMMANDS                   XCALC(1)
  5.  
  6.  
  7.  
  8. NAME
  9.      xcalc - scientific calculator for X
  10.  
  11. SYNOPSIS
  12.      xcalc [-stipple] [-rpn] [-toolkitoption...]
  13.  
  14. DESCRIPTION
  15.      xcalc is a scientific calculator desktop accessory that  can
  16.      emulate a TI-30 or an HP-10C.
  17.  
  18. OPTIONS
  19.      xcalc accepts all  of  the  standard  toolkit  command  line
  20.      options along with two additional options:
  21.  
  22.      -stipple
  23.              This option indicates that  the  background  of  the
  24.              calculator  should  be  drawn using a stipple of the
  25.              foreground and  background  colors.   On  monochrome
  26.              displays improves the appearance.
  27.  
  28.      -rpn    This option indicates that Reverse  Polish  Notation
  29.              should  be  used.   In this mode the calculator will
  30.              look and behave like an HP-10C.  Without this  flag,
  31.              it will emulate a TI-30.
  32.  
  33. OPERATION
  34.      Pointer Usage: Operations may be performed with pointer but-
  35.      ton 1, or in some cases, with the keyboard. Many common cal-
  36.      culator operations have  keyboard  accelerators.   To  quit,
  37.      press  pointer  button 3 on the AC key of the TI calculator,
  38.      or the ON key of the HP calculator.
  39.  
  40.      Calculator Key Usage (TI mode): The numbered keys,  the  +/-
  41.      key,  and the +, -, *, /, and = keys all do exactly what you
  42.      would expect them to.  It should be noted that the operators
  43.      obey  the  standard  rules  of  precedence.   Thus, entering
  44.      "3+4*5=" results in "23", not "35".  The parentheses can  be
  45.      used  to  override  this.   For  example, "(1+2+3)*(4+5+6)="
  46.      results in "6*15=90".
  47.  
  48.      The entire number in the calculator display can be selected,
  49.      in order to paste the result of a calculation into text.
  50.  
  51.      The action procedures  associated  with  each  function  are
  52.      given  below.   These  are  useful  if you are interested in
  53.      defining a custom calculator.  The action used for all digit
  54.      keys is digit(n), where n is the corresponding digit, 0..9.
  55.  
  56.      1/x       Replaces  the  number  in  the  display  with  its
  57.                reciprocal.  The corresponding action procedure is
  58.                reciprocal().
  59.  
  60.  
  61.  
  62.  
  63. X Version 11         Last change: Release 6                     1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. XCALC(1)                 USER COMMANDS                   XCALC(1)
  71.  
  72.  
  73.  
  74.      x^2       Squares  the   number   in   the   display.    The
  75.                corresponding action procedure is square().
  76.  
  77.      SQRT      Takes  the  square  root  of  the  number  in  the
  78.                display.   The  corresponding  action procedure is
  79.                squareRoot().
  80.  
  81.      CE/C      When  pressed  once,  clears  the  number  in  the
  82.                display without clearing the state of the machine.
  83.                Allows you to re-enter a number if you make a mis-
  84.                take.   Pressing  it twice clears the state, also.
  85.                The corresponding action procedure for TI mode  is
  86.                clear().
  87.  
  88.      AC        Clears the display, the  state,  and  the  memory.
  89.                Pressing  it  with  the third pointer button turns
  90.                off the calculator, in that it exits the  program.
  91.                The  action procedure to clear the state is off();
  92.                to quit, quit().
  93.  
  94.      INV       Invert function.  See the individual function keys
  95.                for  details.   The corresponding action procedure
  96.                is inverse().
  97.  
  98.      sin       Computes the sine of the number in the display, as
  99.                interpreted  by  the  current  DRG  mode (see DRG,
  100.                below).  If inverted,  it  computes  the  arcsine.
  101.                The corresponding action procedure is sine().
  102.  
  103.      cos       Computes the cosine, or arccosine  when  inverted.
  104.                The corresponding action procedure is cosine().
  105.  
  106.      tan       Computes the tangent, or arctangent when inverted.
  107.                The corresponding action procedure is tangent().
  108.  
  109.      DRG       Changes the  DRG  mode,  as  indicated  by  'DEG',
  110.                'RAD',  or 'GRAD' at the bottom of of the calcula-
  111.                tor ``liquid crystal''  display.   When  in  'DEG'
  112.                mode,  numbers  in  the display are taken as being
  113.                degrees.  In 'RAD' mode, numbers are  in  radians,
  114.                and  in  'GRAD'  mode, numbers are in grads.  When
  115.                inverted, the DRG key has a feature of  converting
  116.                degrees to radians to grads and vice-versa.  Exam-
  117.                ple:  put the  calculator  into  'DEG'  mode,  and
  118.                enter  "45  INV DRG".  The display should now show
  119.                something along the lines of ".785398",  which  is
  120.                45  degrees converted to radians.  The correspond-
  121.                ing action procedure is degree().
  122.  
  123.      e         The   constant    'e'.     (2.7182818...).     The
  124.                corresponding action procedure is e().
  125.  
  126.  
  127.  
  128.  
  129. X Version 11         Last change: Release 6                     2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. XCALC(1)                 USER COMMANDS                   XCALC(1)
  137.  
  138.  
  139.  
  140.      EE        Used for entering exponential numbers.  For  exam-
  141.                ple,  to get "-2.3E-4" you'd enter "2 . 3 +/- EE 4
  142.                +/-".   The  corresponding  action  procedure   is
  143.                scientific().
  144.  
  145.      log       Calculates the log (base 10) of the number in  the
  146.                display.   When  inverted, it raises "10.0" to the
  147.                number in the display.  For example,  entering  "3
  148.                INV log" should result in "1000".  The correspond-
  149.                ing action procedure is logarithm().
  150.  
  151.      ln        Calculates the log (base e) of the number  in  the
  152.                display.   When  inverted,  it  raises  "e" to the
  153.                number in the display.  For example,  entering  "e
  154.                ln"  should  result  in  "1".   The  corresponding
  155.                action procedure is naturalLog().
  156.  
  157.      y^x       Raises the number on the left to the power of  the
  158.                number  on  the  right.   For  example "2 y^x 3 ="
  159.                results in "8", which is 2^3.  For a further exam-
  160.                ple,  "(1+2+3) y^x (1+2) =" equals "6 y^x 3" which
  161.                equals "216".  The corresponding action  procedure
  162.                is power().
  163.  
  164.      PI        The   constant    'pi'.     (3.1415927....)    The
  165.                corresponding action procedure is pi().
  166.  
  167.      x!        Computes  the  factorial  of  the  number  in  the
  168.                display.   The  number  in  the display must be an
  169.                integer in the range 0-500, though,  depending  on
  170.                your  math  library, it might overflow long before
  171.                that.  The corresponding action procedure is  fac-
  172.                torial().
  173.  
  174.      (         Left parenthesis.  The corresponding  action  pro-
  175.                cedure for TI calculators is leftParen().
  176.  
  177.      )         Right parenthesis.  The corresponding action  pro-
  178.                cedure for TI calculators is rightParen().
  179.  
  180.      /         Division.  The corresponding action  procedure  is
  181.                divide().
  182.  
  183.      *         Multiplication.   The  corresponding  action  pro-
  184.                cedure is multiply().
  185.  
  186.      -         Subtraction.  The corresponding  action  procedure
  187.                is subtract().
  188.  
  189.      +         Addition.  The corresponding action  procedure  is
  190.                add().
  191.  
  192.  
  193.  
  194.  
  195. X Version 11         Last change: Release 6                     3
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. XCALC(1)                 USER COMMANDS                   XCALC(1)
  203.  
  204.  
  205.  
  206.      =         Perform calculation.  The TI-specific action  pro-
  207.                cedure is equal().
  208.  
  209.      STO       Copies the number in the  display  to  the  memory
  210.                location.   The  corresponding action procedure is
  211.                store().
  212.  
  213.      RCL       Copies the number from the memory location to  the
  214.                display.   The  corresponding  action procedure is
  215.                recall().
  216.  
  217.      SUM       Adds the number in the display to  the  number  in
  218.                the  memory  location.   The  corresponding action
  219.                procedure is sum().
  220.  
  221.      EXC       Swaps the number in the display with the number in
  222.                the  memory  location.   The  corresponding action
  223.                procedure for the TI calculator is exchange().
  224.  
  225.      +/-       Negate; change  sign.   The  corresponding  action
  226.                procedure is negate().
  227.  
  228.      .         Decimal point.  The action procedure is decimal().
  229.  
  230.  
  231.      Calculator Key  Usage  (RPN  mode):  The  number  keys,  CHS
  232.      (change sign), +, -, *, /, and ENTR keys all do exactly what
  233.      you would expect them to do.  Many of the remaining keys are
  234.      the same as in TI mode.  The differences are detailed below.
  235.      The action procedure for the ENTR key is enter().
  236.  
  237.  
  238.      <-        This is a backspace key that can be  used  if  you
  239.                make  a  mistake while entering a number.  It will
  240.                erase  digits  from  the  display.   (See   BUGS).
  241.                Inverse  backspace will clear the X register.  The
  242.                corresponding action procedure is back().
  243.  
  244.      ON        Clears the display, the  state,  and  the  memory.
  245.                Pressing  it  with  the third pointer button turns
  246.                off the calculator, in that it exits the  program.
  247.                To  clear  state,  the action procedure is off; to
  248.                quit, quit().
  249.  
  250.      INV       Inverts the meaning of the  function  keys.   This
  251.                would be the  f key on an HP calculator, but xcalc
  252.                does not display multiple  legends  on  each  key.
  253.                See the individual function keys for details.
  254.  
  255.      10^x      Raises "10.0" to the number  in  the  top  of  the
  256.                stack.  When inverted, it calculates the log (base
  257.                10)  of  the   number   in   the   display.    The
  258.  
  259.  
  260.  
  261. X Version 11         Last change: Release 6                     4
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. XCALC(1)                 USER COMMANDS                   XCALC(1)
  269.  
  270.  
  271.  
  272.                corresponding action procedure is tenpower().
  273.  
  274.      e^x       Raises "e" to the number in the top of the  stack.
  275.                When  inverted,  it calculates the log (base e) of
  276.                the number in the display.  The  action  procedure
  277.                is epower().
  278.  
  279.      STO       Copies the number in the top of  the  stack  to  a
  280.                memory  location.   There are 10 memory locations.
  281.                The desired memory is specified by following  this
  282.                key with a digit key.
  283.  
  284.      RCL       Pushes the number from the specified memory  loca-
  285.                tion onto the stack.
  286.  
  287.      SUM       Adds the number on top of the stack to the  number
  288.                in the specified memory location.
  289.  
  290.      x:y       Exchanges the numbers in the top two  stack  posi-
  291.                tions,  the  X and Y registers.  The corresponding
  292.                action procedure is XexchangeY().
  293.  
  294.      R v       Rolls the stack downward.  When inverted, it rolls
  295.                the  stack  upward.  The corresponding action pro-
  296.                cedure is roll().
  297.  
  298.      blank     These keys were used for programming functions  on
  299.                the  HP-10C.   Their  functionality  has  not been
  300.                duplicated in xcalc.
  301.  
  302.      Finally, there are two additional action procedures: bell(),
  303.      which  rings the bell; and selection(), which performs a cut
  304.      on the entire number in the calculator's ``liquid  crystal''
  305.      display.
  306.  
  307. ACCELERATORS
  308.      Accelerators are shortcuts  for  entering  commands.   xcalc
  309.      provides  some  sample keyboard accelerators; also users can
  310.      customize accelerators.   The  numeric  keypad  accelerators
  311.      provided  by  xcalc  should  be  intuitively  correct.   The
  312.      accelerators defined by xcalc on the main keyboard are given
  313.      below:
  314.  
  315.           TI Key    HP Key    Keyboard Accelerator     TI Function    HP Function
  316.  
  317.           SQRT SQRT r              squareRoot()   squareRoot()
  318.           AC   ON   space               clear()        clear()
  319.           AC   <-   Delete              clear()        back()
  320.           AC   <-   Backspace      clear()        back()
  321.           AC   <-   Control-H      clear()        back()
  322.           AC        Clear               clear()
  323.           AC   ON   q              quit()         quit()
  324.  
  325.  
  326.  
  327. X Version 11         Last change: Release 6                     5
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. XCALC(1)                 USER COMMANDS                   XCALC(1)
  335.  
  336.  
  337.  
  338.           AC   ON   Control-C      quit()         quit()
  339.  
  340.           INV  i    i              inverse()      inverse()
  341.           sin  s    s              sine()         sine()
  342.           cos  c    c              cosine()       cosine()
  343.           tan  t    t              tangent() tangent()
  344.           DRG  DRG  d              degree()       degree()
  345.  
  346.           e         e              e()
  347.           ln   ln   l              naturalLog()   naturalLog()
  348.           y^x  y^x  ^              power()        power()
  349.  
  350.           PI   PI   p              pi()      pi()
  351.           x!   x!   !              factorial()    factorial()
  352.           (         (              leftParen()
  353.           )         )              rightParen()
  354.  
  355.           /    /    /              divide()       divide()
  356.           *    *    *              multiply()     multiply()
  357.           -    -    -              subtract()     subtract()
  358.           +    +    +              add()          add()
  359.           =         =              equal()
  360.  
  361.           0..9 0..9 0..9           digit()        digit()
  362.           .    .    .              decimal() decimal()
  363.           +/-  CHS  n              negate()       negate()
  364.  
  365.                x:y  x                        XexchangeY()
  366.                ENTR Return                        enter()
  367.                ENTR Linefeed                      enter()
  368.  
  369. CUSTOMIZATION
  370.      The application class name is XCalc.
  371.  
  372.      xcalc has an enormous application defaults file which speci-
  373.      fies  the  position,  label, and function of each key on the
  374.      calculator.  It also gives translations to serve as keyboard
  375.      accelerators.   Because these resources are not specified in
  376.      the source code, you can create a customized  calculator  by
  377.      writing  a  private  application  defaults  file,  using the
  378.      Athena Command and Form widget resources to specify the size
  379.      and  position of buttons, the label for each button, and the
  380.      function of each button.
  381.  
  382.      The foreground and background colors of each calculator  key
  383.      can  be  individually  specified.   For the TI calculator, a
  384.      classical color resource specification might be:
  385.  
  386.      XCalc.ti.Command.background:  gray50
  387.      XCalc.ti.Command.foreground:  white
  388.  
  389.      For each of buttons 20, 25, 30, 35, and 40, specify:
  390.  
  391.  
  392.  
  393. X Version 11         Last change: Release 6                     6
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400. XCALC(1)                 USER COMMANDS                   XCALC(1)
  401.  
  402.  
  403.  
  404.      XCalc.ti.button20.background: black
  405.      XCalc.ti.button20.foreground: white
  406.  
  407.      For each of buttons 22, 23, 24, 27, 28, 29, 32, 33, 34,  37,
  408.      38, and 39:
  409.      XCalc.ti.button22.background: white
  410.      XCalc.ti.button22.foreground: black
  411.  
  412. WIDGET HIERARCHY
  413.      In order to specify resources, it  is  useful  to  know  the
  414.      hierarchy  of the widgets which compose xcalc.  In the nota-
  415.      tion below, indentation  indicates  hierarchical  structure.
  416.      The widget class name is given first, followed by the widget
  417.      instance name.
  418.  
  419.      XCalc xcalc
  420.           Form  ti  or  hp    (the name depends on the mode)
  421.                Form  bevel
  422.                     Form  screen
  423.                          Label  M
  424.                          Toggle  LCD
  425.                          Label  INV
  426.                          Label  DEG
  427.                          Label  RAD
  428.                          Label  GRAD
  429.                          Label  P
  430.                Command  button1
  431.                Command  button2
  432.                Command  button3
  433.      and so on, ...
  434.                Command  button38
  435.                Command  button39
  436.                Command  button40
  437.  
  438. APPLICATION RESOURCES
  439.      rpn (Class Rpn)
  440.              Specifies that the rpn mode  should  be  used.   The
  441.              default is TI mode.
  442.  
  443.      stipple (Class Stipple)
  444.              Indicates that the background  should  be  stippled.
  445.              The  default  is ``on'' for monochrome displays, and
  446.              ``off'' for color displays.
  447.  
  448.      cursor (Class Cursor)
  449.              The  name  of  the  symbol  used  to  represent  the
  450.              pointer.  The default is ``hand2''.
  451.  
  452. COLORS
  453.      If you would like xcalc to use its ti  colors,  include  the
  454.      following  in  the #ifdef COLOR section of the file you read
  455.      with xrdb:
  456.  
  457.  
  458.  
  459. X Version 11         Last change: Release 6                     7
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466. XCALC(1)                 USER COMMANDS                   XCALC(1)
  467.  
  468.  
  469.  
  470.      *customization:                 -color
  471.  
  472.      This will cause xcalc to pick up  the  colors  in  the  app-
  473.      defaults   color  customization  file:  <XRoot>/lib/X11/app-
  474.      defaults/XCalc-color.
  475.  
  476. SEE ALSO
  477.      X(1), xrdb(1), the Athena Widget Set
  478.  
  479. BUGS
  480.      HP mode:  A bug report claims that the sequence of  keys  5,
  481.      ENTER, <- should clear the display, but it doesn't.
  482.  
  483. COPYRIGHT
  484.      Copyright ([
  485.                  ,*) X Consortium
  486.      See X(1) for a full statement of rights and permissions.
  487.  
  488. AUTHORS
  489.      John Bradley, University of Pennsylvania
  490.      Mark Rosenstein, MIT Project Athena
  491.      Donna Converse, MIT X Consortium
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526. X Version 11         Last change: Release 6                     8
  527.  
  528.  
  529.  
  530.